SELE 1
IF REC_LOCK(0)
   REPL ST_REORDER WITH .T.
   REPL ST_RE_PROP WITH .F.
   REPL ST_RE_QANT WITH NUM
ENDIF
UNLOCK
SELE 2
if fil_lock(0)
   append blank
endif
if rec_lock(0)
   CODEMAC=SUBS(F1,1,4)+'_CODE'
   NAMEMAC=SUBS(F1,1,4)+'_NAME'
   TYPEMAC=SUBS(F1,1,4)+'_TYPE'
   QANTMAC=SUBS(F1,1,4)+'_QANT'
   UNITMAC=SUBS(F1,1,4)+'_UNIT'
   REPL &CODEMAC   WITH KODE
   REPL &NAMEMAC   WITH NAME
   REPL &UNITMAC   WITH UNIT
   REPL &TYPEMAC   WITH TIPE
   REPL &QANTMAC   WITH QANT
   REPL BUY_UNIT   WITH BUYUNIT
   REPL U_PR_PURCH WITH PRIC
   REPL QANT_PURCH WITH NUM
   REPL VALU_PURCH WITH NUM*PRIC
   REPL SUPP_CODE  WITH SUPPCOD
   REPL SUPP_NAME  WITH SUPPNAM
   REPL DISC_PURCH WITH DISC
   REPL NET_PURCH WITH VALU
   REPL AEA_COMP WITH FREEP
   REPL ORDER_NBER WITH PRNUM
   REPL DATE_PURCH WITH DATE()
endif
unlock
SELE 1
RETURN
